package br.com.ngame;

import br.com.ngame.core.GameCore;
import br.com.ngame.core.GameCoreListener;
import br.com.ngame.device.BasicAudioDevice;
import br.com.ngame.device.BasicInputDevice;
import br.com.ngame.device.WindowedVideoDevice;
import br.com.ngame.manager.WindowedImageManager;
import br.com.ngame.manager.WindowedSoundManager;
import java.awt.Frame;

public abstract class WindowedGame implements GameCoreListener
{
	private static final long serialVersionUID = 1L;
	private GameCore game;

	public WindowedGame()
	{
		this(800, 600);
	}

	public WindowedGame(int width, int height)
	{
		log("WINDOW CREATE (" + width + "x" + height + ") >");
		game = new GameCore(this);
		game.setVideoDevice(new WindowedVideoDevice(width, height));
		game.setAudioDevice(new BasicAudioDevice());
		game.setInputDevice(new BasicInputDevice(game.getVideoDevice().getFrame()));
		game.setImageManager(new WindowedImageManager(game.getVideoDevice()));
		game.setSoundManager(new WindowedSoundManager(game.getVideoDevice().getFrame()));
		log("WINDOW CREATE <");
	}

	protected boolean setGameWindow(Frame window)
	{
//		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		return false;
	}

	protected GameCore getGame()
	{
		return game;
	}

	public void log(String msg)
	{
		System.out.println(msg);
	}

	public void setup()
	{
		// personalizado nas classes filhas
	}

	public void cleanup()
	{
		// personalizado nas classes filhas
	}

	public void enterMenu()
	{
//		 personalizado nas classes filhas
	}

	public void enterPause()
	{
//		 personalizado nas classes filhas
	}

	public void exitMenu()
	{
//		 personalizado nas classes filhas
	}

	public void exitPause()
	{
//		 personalizado nas classes filhas
	}
}